/*
 * Tezad - Classic puzzle game
 * Copyright 2009 Shayne Riley and Paul Maseberg
 *
 * Tezad is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Tezad is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Tezad.  If not, see <http://www.gnu.org/licenses/>
 * or write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * To contact the authors on questions or issues regarding the license,
 * you may send an email to <pezads at gmail dot com>
 */

#include "InputReqs.h"

InputReqs::InputReqs(int inputType, bool pressed)
: mInputType(inputType), mPressed(pressed)
{ /* handle range badness here. */ }

InputReqs::~InputReqs() { /* Does nothing */ }

void InputReqs::execute(CommandActions &actions) const
{
    switch (mInputType)
    {
    case IN_SHIFT_LEFT:
        actions.inputReqShiftLeft(mPressed);
        break;
    case IN_SHIFT_RIGHT:
        actions.inputReqShiftRight(mPressed);
        break;
    case IN_SOFT_DOWN:
        actions.inputReqSoftDown(mPressed);
        break;
    case IN_HARD_DOWN:
        if (mPressed)
        {
            actions.inputReqHardDown();
        }
        break;
    case IN_ROTATE_CCW:
        if (mPressed)
        {
            actions.inputReqRotateCCW();
        }
        break;
    case IN_ROTATE_CW:
        if (mPressed)
        {
            actions.inputReqRotateCW();
        }
        break;
   default:
        throw 0; // hahahaha I'm so bad
        break;
    }
}
